#!c:\Program Files\Python39\python.exe # -*- coding: Latin-1 -*- # ***** include the biocase.lib directory in the python sys path for importing ***** import os, sys exec(open(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir, os.path.pardir, 'lib', 'biocase', 'adjustpath.py'))).read()) import cgitb; cgitb.enable() import cgi, logging import biocase.configuration from biocase.tools.templating import PageMacro from biocase import __version__ cfg = biocase.configuration.Cfg() # read template tmpl = PageMacro('Content', PageMacro.DELMODE) tmpl.load('Content', os.path.join(cfg.wwwLocator,'utilities','queryforms','_qf_manual.html') ) # get wrapper url form = biocase.configuration.sanitiseFieldStorage(cgi.FieldStorage()) dsa=None if 'dsa' in form: from biocase.datasources import Datasource dsa = form.getfirst('dsa') try: dsaObj = Datasource(name=dsa) wrapper_url = dsaObj.getBioCASeAccessPoint() psfObj = dsaObj.getPSFObj() except: sys.stdout.write('Content-Type: text/plain\n\n') sys.exit("Datasource %s doesn't exist." % dsa) else: sys.stdout.write('Content-Type: text/plain\n\n') sys.exit("No data source name found, please use parameter 'dsa'.") # fill template with url tmpl['dsa'] = dsa tmpl['wrapper_url']=wrapper_url tmpl['ServiceTitle'] = 'BioCASe Provider Software %s' % __version__ logLoc = cfg.logLocator.replace("\\", "\\\\") if cfg.server.debug: if dsa is None: tmpl['cfg.server.debug']='%s. Logs at %s' %(cfg.html.true, logLoc) else: tmpl['cfg.server.debug']='%s. Logs at %s' %(logging.getLevelName(psfObj.loglevel), logLoc) else: if dsa is None: tmpl['cfg.server.debug']='%s. Logs at %s' %(cfg.html.false, logLoc) else: tmpl['cfg.server.debug']='%s. Logs at %s' %(logging.getLevelName(psfObj.loglevel), logLoc) # # print HTML # print('Content-Type: text/html; charset=utf-8\n\n') print(str(tmpl))